package com.itheime.homework04;

import java.io.*;

public class CopyTest02 {
    public static void main(String[] args) {

        try(
                BufferedInputStream bis = new BufferedInputStream(new FileInputStream("d:/img1/photo.png"));
                BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("d:/img2/photo2.png"));
                ) {

            byte[] buffer = new byte[1024];
            int len;
            while ((len = bis.read(buffer)) != -1) {
                bos.write(buffer,0,len);
            }
        }  catch (IOException e) {
            e.printStackTrace();
        }
    }
}
